<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">

<head th:include="include :: header"></head>

<style>

    #license1{
        display: none;
    }

    #brandImgs{
        display: table;
        width: 100%;
    }
    .closeBtn{
        position: relative;
        cursor:pointer;
        width:150px;height:150px;
        margin-right: 15px;margin-bottom: 15px;
        float: left;
    }

    .closeBtn .upImg{
        width:100%;height:100%;display:block;border-radius: 5px;

    }

    .closeBtn .iconclose{
        position: absolute;
        top: 5px;
        right: 5px;
        width: 16px;
        height: 16px;
    }
    .closeBtn .iconclose img{
        width: 100%;
        height: 100%;
    }

</style>


<!--    添加考试用户页面 -->

<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="signupForm">

                        <input type="hidden" name="id" th:value="${examUserRegistrationDO.id}">

                        <div class="form-group">
                            <label class="col-sm-3 control-label">姓名：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" placeholder="姓名请输入" name="name" id="name" th:value="${examUserRegistrationDO.name}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">性别：</label>
                            <div class="col-sm-8">
                                <input type="hidden" id="sex" th:value="${examUserRegistrationDO.gender}">
                                <label for="girl"><input id="girl" type="radio" name="gender" value="2" >女</label>
                                <label for="male"><input id="male" type="radio" name="gender" value="1">男</label>

                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">联系方式：</label>
                            <div class="col-sm-8">
                                <input id="contact" name="contact" placeholder="联系方式" class="form-control" type="text" th:value="${examUserRegistrationDO.contact}">

                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">政治面貌：</label>
                            <div class="col-sm-8">
                                <input type="hidden" id="polStatus" th:value="${examUserRegistrationDO.politicalStatus}">
                                <select name="politicalStatus" id="politicalStatus" class="form-control" >
                                    <option value="">请选择</option>
                                    <option value="1">群众</option>
                                    <option value="2">中共党员</option>
                                    <option value="3">共青团员</option>
                                    <option value="4">中共预备党员</option>
                                    <option value="5">无党派人士</option>
                                    <option value="6">其他民主党派人士</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">联系邮箱：</label>
                            <div class="col-sm-8">
                                <input id="email" name="email" class="form-control" type="text" placeholder="联系邮箱" th:value="${examUserRegistrationDO.email}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">身份证号码：</label>
                            <div class="col-sm-8">
                                <input id="idCardNumber" name="idCardNumber" class="form-control" type="text" placeholder="身份证号码" th:value="${examUserRegistrationDO.idCardNumber}">
                            </div>
                        </div>

<!--                        <div class="form-group">-->
<!--                            <label class="col-sm-3 control-label">所在省份：</label>-->
<!--                            <div class="col-sm-8">-->
<!--                            </div>-->
<!--                        </div>-->

                        <div class="form-group">
                            <label class="col-sm-3 control-label">所在省份：</label>
                            <div class="col-sm-8">
                                <select name="province" id="province" class="form-control"></select>
                                <input id="province1"  class="form-control" type="hidden" th:value="${examUserRegistrationDO.province}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">所在市：</label>
                            <div class="col-sm-8">
                                <select name="city" id="city" class="form-control">
                                    <option value="">请选择</option>
                                </select>
                                <input id="city1"  class="form-control" type="hidden" th:value="${examUserRegistrationDO.city}">
                            </div>
                        </div>

<!--                        <div class="form-group">-->
<!--                            <label class="col-sm-3 control-label">所在区：</label>-->
<!--                            <div class="col-sm-8">-->
<!--                                <select name="area" id="area" class="form-control">-->
<!--                                    <option value="">请选择</option>-->
<!--                                </select>-->
<!--                                <input id="area1"  class="form-control" type="hidden" th:value="${examUserRegistrationDO.city}">-->
<!--                            </div>-->
<!--                        </div>-->

                        <div class="form-group">
                            <label class="col-sm-3 control-label">单位名称：</label>
                            <div class="col-sm-8">
                                <input id="companyName" name="companyName" class="form-control" placeholder="单位名称" type="text" th:value="${examUserRegistrationDO.companyName}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">所在专业：</label>
                            <div class="col-sm-8">
                                <input name="major" id="major" placeholder="所在专业" class="form-control" th:value="${examUserRegistrationDO.major}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">职位：</label>
                            <div class="col-sm-8">

                                <input type="hidden" id="posInfo" th:value="${examUserRegistrationDO.positionInfo}">
                                <select name="positionInfo" id="positionInfo" class="form-control" >
                                    <option value="">请选择</option>
                                    <option value="1">院长</option>
                                    <option value="2">副院长</option>
                                    <option value="3">主任</option>
                                    <option value="4">副主任</option>
                                    <option value="5">学科带头人</option>
                                    <option value="6">专业负责人</option>
                                    <option value="7">专业教师</option>
                                    <option value="8">其他</option>
                                    <option value="9">无</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">职称：</label>
                            <div class="col-sm-8">

                                <input type="hidden" id="tleInfo" th:value="${examUserRegistrationDO.titleInfo}">
                                <select name="titleInfo" id="titleInfo" class="form-control" >
                                    <option value="">请选择</option>
                                    <option value="1">教授</option>
                                    <option value="2">副教授</option>
                                    <option value="3">讲师</option>
                                    <option value="4">助教</option>
                                    <option value="5">无</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">开票单位名称：</label>
                            <div class="col-sm-8">
                                <input name="companyCodeName" id="companyCodeName" placeholder="发票单位名称" class="form-control" th:value="${examUserRegistrationDO.companyCodeName}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">税号：</label>
                            <div class="col-sm-8">
                                <input name="taxNumber" id="taxNumber" placeholder="税号" class="form-control"  th:value="${examUserRegistrationDO.taxNumber}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">统一社会代码：</label>
                            <div class="col-sm-8">
                                <input id="creditCode" name="creditCode" class="form-control" rows="5" placeholder="统一社会代码" th:value="${examUserRegistrationDO.creditCode}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">收件地址：</label>
                            <div class="col-sm-8">
                                <input id="detailedMailingAddress" name="detailedMailingAddress" class="form-control" placeholder="收件地址" th:value="${examUserRegistrationDO.detailedMailingAddress}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">照片信息：</label>
                            <div class="col-sm-8">
                                <div id="license1"></div>
                                <input type="hidden" id="license" name="photoInfo" th:value="${examUserRegistrationDO.photoInfo}">
                                <button type="button" class="btn btn-success" id="business" style="margin-top: 10px;">
                                    <i class="fa fa-cloud"></i>照片信息
                                </button>
                            </div>
                        </div>

                        <div class="form-group certificationType">
                            <label class="col-sm-3 control-label">资质类型：</label>
                            <div class="col-sm-8">
                                <input id="certificationType" name="certificationType" class="form-control" rows="5" placeholder="资质类型" th:value="${examUserRegistrationDO.certificationType}">
                            </div>
                        </div>

                        <div class="form-group certificateUrl">
                            <label class="col-sm-3 control-label">相应证书：</label>
                            <div class="col-sm-8">
<!--                                <input id="certificateUrl" name="certificateUrl" class="form-control" rows="5" placeholder="已获得相应证书" th:value="${examUserRegistrationDO.certificateUrl}">-->
                                <div id="brandlogo"></div>
                                <input type="hidden" id="certificateUrl" name="certificateUrl" th:value="${examUserRegistrationDO.certificateUrl}">
                                <button type="button" class="btn btn-success" id="btnAddes" style="margin-top: 10px;">
                                    <i class="fa fa-cloud"></i>上传图片
                                </button>

                            </div>
                        </div>

                        <div class="form-group schoolRecommend" >
                            <label class="col-sm-3 control-label">高校推荐：</label>
                            <div class="col-sm-8">
<!--                                <input id="schoolRecommend" name="schoolRecommend" class="form-control" rows="5" placeholder="高校推荐" th:value="${examUserRegistrationDO.schoolRecommend}">-->

                                <div id="brandImgs"></div>
                                <input type="hidden" id="brandImgas" name="schoolRecommend" th:value="${examUserRegistrationDO.schoolRecommend}">
                                <button type="button" class="btn btn-success" id="btnAdd" style="margin-top: 10px;">
                                    <i class="fa fa-cloud"></i>上传图片
                                </button>

                            </div>
                        </div>

                        <div class="form-group schoolName" >
                            <label class="col-sm-3 control-label">试点院校：</label>
                            <div class="col-sm-8">
                                <input id="schoolName" name="schoolName" class="form-control" rows="5" placeholder="资质类型" th:value="${examUserRegistrationDO.schoolName}">
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button onclick="editSave()" class="btn btn-primary">提交</button>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="include::footer"></div>

<script type="text/javascript" src="/js/webJs/jzweb/examRegistration/addExamUserRegistration.js">
</script>

<script>

    let sex = $("#sex").val();
    if( $("#male").val() == sex) $("#male").attr('checked',true)
    if( $("#girl").val() == sex) $("#girl").attr('checked',true)

    let lice = $("#license").val();

    if( lice ){
        let str = `
            <div class="closeBtn">
                <img class="upImg" src="${ $("#license").val() }" width="100" height="100"/>
                <span class="iconclose"><img src="../../../img/close.png"></span>
            </div>
        `;
        $("#license1").html(str).show();

        $(".iconclose").click(function (){
            $(this).parent('.closeBtn').remove();
            $("#license1").html('')
            $("#license").val('')
        })
    }


    function invoking(){
        var brand = $("#brandImgas").val().split(','), str = '',srr = '';

        brand = brand.filter(item => {
            return item.length > 0
        });
        brand.map(function (item, index) {
            str += `
                    <div class="closeBtn">
                        <img class="upImg" src="${item}"/>
                        <span class="iconclose"><img src="../../../img/close.png"></span>
                     </div>
                `;
        })

        $("#brandImgs").html(str);

        $("#brandImgs").find(".iconclose").click(function (){
            $(this).parent('.closeBtn').remove();
            returnImg('#brandImgs','#brandImgas');
        })


        if( $("#certificateUrl").val() ){
            brand = $("#certificateUrl").val().split(','), str = '',srr = '';
            brand = brand.filter(item => {
                return item.length > 0
            });
            brand.map(function (item, index) {
                str += `
                    <div class="closeBtn">
                        <img class="upImg" src="${item}"/>
                        <span class="iconclose"><img src="../../../img/close.png"></span>
                     </div>
                `;
            })

            $("#brandlogo").html(str);

        }

        $("#brandlogo").find(".iconclose").click(function (){
            $(this).parent('.closeBtn').remove();
            $("#brandlogo").val('');
            returnImg('#brandlogo','#certificateUrl')
        })


    }

    invoking();


    if (!$("#certificationType").val()) $(".certificationType").hide()
    if (!$("#certificateUrl").val()) $(".certificateUrl").hide()
    if (!$("#brandImgas").val()) $(".schoolRecommend").hide()
    if (!$("#schoolName").val()) $(".schoolName").hide()


</script>

</body>
</html>



